#ifndef LSR_H
#define LSR_H

const int NEIGHBORHOOD_RADIUS = 4;
const int SMOOTHING_ITERS = 4;
const int MIN_CELLS = 50;
const int MIN_LENGTH = 50;
const int MAX_LENGTH = 500;
const double MAG_THRESH = 50.0;//60 (arbitrary)
const double ANGLE_TOL = 30*3.14159/180;//60

//For image processing:
const int SCALE = 1;
const int DELTA = 0;
const int DDEPTH = CV_16S;

class LSR {
    bool keeper;
    int *cells;
    int *linePoints; // {start, end}
    double *depths;  // {start, middle, end}
    double orientation, length;
    int centroid, area;  
    public:
    LSR(){}
    LSR(int numCells, int *cellAddrs, double orient, Mat img);
    int *getCells();
    int getArea();
    int getCentroid();
    double getOrientation();
    double getLength();
    bool isKeeper();
    int *getLinePoints();
    double *getDepths();
};

double depthAtPoint(int addr, Mat img);
int getNextPix(int* mags, bool* used, int length);
double* regionGrow(int *region, double *angles, int *mags, bool *used, Mat drawImg);
double levelLine(double gradAngle);
int findLSRs(LSR *allLSRs, Mat img);
int *findLine(int *bb, int center, double orient);
int *findNeighborhood(int cellAddr, int radius);


#endif
